package 数组Array.一维数组.test01;

public class ArrayTest01 {
    public static void main(String[] args) {
        int[] a = {10,100,200,20,89,46};
        System.out.println("元素个数" + a.length);
        System.out.println("第一个元素 = " + a[0]);
        System.out.println("最后一个元素" + a[a.length - 1]);
        a[0] = 111;
        a[a.length - 1] = 999;
        System.out.println("第一个元素 = " + a[0]);
        System.out.println("最后一个元素" + a[a.length - 1]);
        for(int i = 0;i < a.length;i++){
            System.out.println(a[i]);
        }
        //System.out.println(a[6]);     ArrayIndexOutOfBoundsException   出现异常
    }
}
